package com.mystore.framework.pojo;

import java.util.Date;
import java.io.Serializable;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import icu.mhb.mybatisplus.plugln.annotations.JoinField;
import icu.mhb.mybatisplus.plugln.constant.RelevancyType;
import lombok.Setter;
import lombok.Getter;
import lombok.ToString;
import org.springframework.cache.annotation.Cacheable;

import javax.validation.constraints.NotBlank;

/**
 * 用户表(User)实体类
 *
 * @author MyStore
 * @since 2023-06-28 14:04:58
 */

@Getter
@Setter
@Cacheable("user")
@ToString
public class User implements Serializable {
    private static final long serialVersionUID = -88976164084400831L;
    /**
     * 用户ID
     */
    @TableId(type = IdType.AUTO)
    private Integer userId;
    /**
     * 用户名
     */
    private String userName;
    /**
     * 用户邮箱
     */
    @NotBlank
    private String userEmail;
    /**
     * 用户密码
     */
    @NotBlank
    private String userPassword;
    /**
     * 角色id
     */
    private Integer roleId;
    @TableField(exist = false)
    @JoinField(masterModelClass = User.class, masterModelField = "roleId",
            sunModelClass = Role.class, sunModelField = "roleId", relevancyType = RelevancyType.ONT_TO_ONE,
            sunAlias = "t2")
    private Role role;
    @TableField(exist = false)
    private String userNewPassword;
    /**
     * 权限列表
     */
    private String rights;
    /**
     * 上次登录时间
     */
    private Date lastTime;

    private Integer enabled;


}

